home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / prolog_2.zip / PUZZLES.ZIP / FAMILY.PRO < prev    next >
Text File  |  1986-07-20  |  768b  |  28 lines

  1. /* To analyze the family structure of the family of Queen Victoria.
  2. English friend of mine notes there wasn't a Harry. I put him in.
  3.  
  4. Answers the compelling question: Who is X the sister of?
  5.  
  6. Ask: ?-sisterof( alice, X ). or ?-sisterof( alice, harry ).
  7.  
  8.   or ?-sisterof( alice, X ), loves( X, wine ). as an example of a
  9.   complex question. 
  10.  
  11. or even:
  12.  
  13. sisterof( alice, X ), loves( X, wine ), loves( alice, wine ).
  14.  
  15. */
  16.  
  17. sisterof( X, Y ) :- parents( X, M, F ), 
  18.                     female( X ),
  19.                     parents( Y, M, F ).
  20.  
  21. parents( edward, victoria, albert ).
  22. parents( harry, victoria, albert ).
  23. parents( alice, victoria, albert ).
  24. female( alice ).
  25.  
  26. loves( harry, wine ).
  27. loves( alice, wine ).
  28.